<template>
  <div class="addrManager">
    <div class="item">
      <div class="addr-headline"></div>
 
    
      <div class="addr" v-for="(item,index ) in addrList" :key="index">
        <div class="addr-info">
        <div class="info-name">
          <span>{{item.name}}</span>
          <span v-if="item.is_default">默认</span>
        </div>
        <div class="contact">
          <div class="c-phone">{{item.mobile}}</div>
          <div class="c-addr">{{item.address + item.address_detail}}</div>
        </div>
        <div class="sysbol">
        </div>
        </div>
      </div>
    </div>
      

    <div class="methods">
      <div class="addAddr" @click="addaddress">+新建地址</div>
      <div class="importAddr">一键导入微信地址</div>
    </div>

  </div>
</template>

<script>
export default {
  data(){
    return{
      name:'111',
      openId:'',
      addrList:[]
    }
  },
  mounted(){
    this.openId = this.$api.getOpenId()
    this.getReveal()
  },
  methods:{
    async getReveal(){
      let result = await this.$api.address.reqReveal({openId:this.openId})
      this.addrList = result.address
      console.log(this.addrList);
    },
    addaddress(){
      wx.navigateTo({ url: '/pages/addredit/main' });
    }
  }
}
</script>

<style lang="less" scoped>
@import './index.less';
</style>